3.1.75 \(\int (a+b \sin ^2(x))^2 \, dx\) [75]

Optimal. Leaf size=50 \[ \frac {1}{8} \left (8 a^2+8 a b+3 b^2\right ) x-\frac {1}{8} b (8 a+3 b) \cos (x) \sin (x)-\frac {1}{4} b^2 \cos (x) \sin ^3(x) \]

[Out]

1/8*(8*a^2+8*a*b+3*b^2)*x-1/8*b*(8*a+3*b)*cos(x)*sin(x)-1/4*b^2*cos(x)*sin(x)^3

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {3258} \begin {gather*} \frac {1}{8} x \left (8 a^2+8 a b+3 b^2\right )-\frac {1}{8} b (8 a+3 b) \sin (x) \cos (x)-\frac {1}{4} b^2 \sin ^3(x) \cos (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*Sin[x]^2)^2,x]

[Out]

((8*a^2 + 8*a*b + 3*b^2)*x)/8 - (b*(8*a + 3*b)*Cos[x]*Sin[x])/8 - (b^2*Cos[x]*Sin[x]^3)/4

Rule 3258

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^2, x_Symbol] :> Simp[(8*a^2 + 8*a*b + 3*b^2)*(x/8), x] + (-Simp[b
^2*Cos[e + f*x]*(Sin[e + f*x]^3/(4*f)), x] - Simp[b*(8*a + 3*b)*Cos[e + f*x]*(Sin[e + f*x]/(8*f)), x]) /; Free
Q[{a, b, e, f}, x]

Rubi steps

\begin {align*} \int \left (a+b \sin ^2(x)\right )^2 \, dx &=\frac {1}{8} \left (8 a^2+8 a b+3 b^2\right ) x-\frac {1}{8} b (8 a+3 b) \cos (x) \sin (x)-\frac {1}{4} b^2 \cos (x) \sin ^3(x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 43, normalized size = 0.86 \begin {gather*} \frac {1}{32} \left (4 \left (8 a^2+8 a b+3 b^2\right ) x-8 b (2 a+b) \sin (2 x)+b^2 \sin (4 x)\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sin[x]^2)^2,x]

[Out]

(4*(8*a^2 + 8*a*b + 3*b^2)*x - 8*b*(2*a + b)*Sin[2*x] + b^2*Sin[4*x])/32

________________________________________________________________________________________

Maple [A]
time = 0.19, size = 42, normalized size = 0.84

method result size
default \(b^{2} \left (-\frac {\left (\sin ^{3}\left (x \right )+\frac {3 \sin \left (x \right )}{2}\right ) \cos \left (x \right )}{4}+\frac {3 x}{8}\right )+2 a b \left (-\frac {\sin \left (x \right ) \cos \left (x \right )}{2}+\frac {x}{2}\right )+a^{2} x\) \(42\)
risch \(a^{2} x +a b x +\frac {3 b^{2} x}{8}+\frac {b^{2} \sin \left (4 x \right )}{32}-\frac {\sin \left (2 x \right ) a b}{2}-\frac {\sin \left (2 x \right ) b^{2}}{4}\) \(43\)
norman \(\frac {\left (-2 a b -\frac {11}{4} b^{2}\right ) \left (\tan ^{3}\left (\frac {x}{2}\right )\right )+\left (-2 a b -\frac {3}{4} b^{2}\right ) \tan \left (\frac {x}{2}\right )+\left (2 a b +\frac {3}{4} b^{2}\right ) \left (\tan ^{7}\left (\frac {x}{2}\right )\right )+\left (2 a b +\frac {11}{4} b^{2}\right ) \left (\tan ^{5}\left (\frac {x}{2}\right )\right )+\left (a^{2}+a b +\frac {3}{8} b^{2}\right ) x +\left (a^{2}+a b +\frac {3}{8} b^{2}\right ) x \left (\tan ^{8}\left (\frac {x}{2}\right )\right )+\left (4 a^{2}+4 a b +\frac {3}{2} b^{2}\right ) x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+\left (4 a^{2}+4 a b +\frac {3}{2} b^{2}\right ) x \left (\tan ^{6}\left (\frac {x}{2}\right )\right )+\left (6 a^{2}+6 a b +\frac {9}{4} b^{2}\right ) x \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )^{4}}\) \(182\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sin(x)^2)^2,x,method=_RETURNVERBOSE)

[Out]

b^2*(-1/4*(sin(x)^3+3/2*sin(x))*cos(x)+3/8*x)+2*a*b*(-1/2*sin(x)*cos(x)+1/2*x)+a^2*x

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 39, normalized size = 0.78 \begin {gather*} \frac {1}{32} \, b^{2} {\left (12 \, x + \sin \left (4 \, x\right ) - 8 \, \sin \left (2 \, x\right )\right )} + \frac {1}{2} \, a b {\left (2 \, x - \sin \left (2 \, x\right )\right )} + a^{2} x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(x)^2)^2,x, algorithm="maxima")

[Out]

1/32*b^2*(12*x + sin(4*x) - 8*sin(2*x)) + 1/2*a*b*(2*x - sin(2*x)) + a^2*x

________________________________________________________________________________________

Fricas [A]
time = 0.39, size = 47, normalized size = 0.94 \begin {gather*} \frac {1}{8} \, {\left (8 \, a^{2} + 8 \, a b + 3 \, b^{2}\right )} x + \frac {1}{8} \, {\left (2 \, b^{2} \cos \left (x\right )^{3} - {\left (8 \, a b + 5 \, b^{2}\right )} \cos \left (x\right )\right )} \sin \left (x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(x)^2)^2,x, algorithm="fricas")

[Out]

1/8*(8*a^2 + 8*a*b + 3*b^2)*x + 1/8*(2*b^2*cos(x)^3 - (8*a*b + 5*b^2)*cos(x))*sin(x)

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 110 vs. \(2 (44) = 88\).
time = 0.14, size = 110, normalized size = 2.20 \begin {gather*} a^{2} x + a b x \sin ^{2}{\left (x \right )} + a b x \cos ^{2}{\left (x \right )} - a b \sin {\left (x \right )} \cos {\left (x \right )} + \frac {3 b^{2} x \sin ^{4}{\left (x \right )}}{8} + \frac {3 b^{2} x \sin ^{2}{\left (x \right )} \cos ^{2}{\left (x \right )}}{4} + \frac {3 b^{2} x \cos ^{4}{\left (x \right )}}{8} - \frac {5 b^{2} \sin ^{3}{\left (x \right )} \cos {\left (x \right )}}{8} - \frac {3 b^{2} \sin {\left (x \right )} \cos ^{3}{\left (x \right )}}{8} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(x)**2)**2,x)

[Out]

a**2*x + a*b*x*sin(x)**2 + a*b*x*cos(x)**2 - a*b*sin(x)*cos(x) + 3*b**2*x*sin(x)**4/8 + 3*b**2*x*sin(x)**2*cos
(x)**2/4 + 3*b**2*x*cos(x)**4/8 - 5*b**2*sin(x)**3*cos(x)/8 - 3*b**2*sin(x)*cos(x)**3/8

________________________________________________________________________________________

Giac [A]
time = 0.41, size = 42, normalized size = 0.84 \begin {gather*} \frac {1}{32} \, b^{2} \sin \left (4 \, x\right ) + \frac {1}{8} \, {\left (8 \, a^{2} + 8 \, a b + 3 \, b^{2}\right )} x - \frac {1}{4} \, {\left (2 \, a b + b^{2}\right )} \sin \left (2 \, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sin(x)^2)^2,x, algorithm="giac")

[Out]

1/32*b^2*sin(4*x) + 1/8*(8*a^2 + 8*a*b + 3*b^2)*x - 1/4*(2*a*b + b^2)*sin(2*x)

________________________________________________________________________________________

Mupad [B]
time = 13.52, size = 44, normalized size = 0.88 \begin {gather*} x\,a^2-\sin \left (x\right )\,a\,b\,\cos \left (x\right )+x\,a\,b+\frac {\sin \left (x\right )\,b^2\,{\cos \left (x\right )}^3}{4}-\frac {5\,\sin \left (x\right )\,b^2\,\cos \left (x\right )}{8}+\frac {3\,x\,b^2}{8} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*sin(x)^2)^2,x)

[Out]

a^2*x + (3*b^2*x)/8 + (b^2*cos(x)^3*sin(x))/4 + a*b*x - (5*b^2*cos(x)*sin(x))/8 - a*b*cos(x)*sin(x)

________________________________________________________________________________________